RoadMap Class Reference

#include <Road.h>

List of all members.

Public Member Functions

 RoadMap (osg::ref_ptr< osg::Group > sgroot)
void addRoadMaptoRoot (osg::ref_ptr< osg::Group > sgroot, int flag)
void loadRoadScene (void)
osg::Vec3d getpt (const int np)
osg::Group * makedelaunay ()
void addNewRoad (RoadType type)
void addPoint (osg::Vec3 position)
void setActiveRoadIndex (int index)
int getActiveRoadIndex (void)
int getLastRoadIndex ()
void pinControl (osg::ref_ptr< osg::Group > sgroot)
void clearRoadMap ()
osg::ref_ptr< osg::Group > returnRoadNode ()
void addRoadNode (osg::ref_ptr< osg::Node > roadNodeToBeAdded)

Private Attributes

vector< Road * > roadMap
int currentRoadIndex
int lastRoadIndex
int pinFlag
osg::Vec3Array * points
osg::ref_ptr< osg::Group > roadRoot
osg::ref_ptr< osg::Group > dotRootNode
osg::ref_ptr< osg::Group > lineRootNode
osg::ref_ptr< osg::Group > linedotRoot
osg::ref_ptr< osg::Group > savedMap

Friends

class Road


Detailed Description

Definition at line 141 of file Road.h.


Constructor & Destructor Documentation

RoadMap::RoadMap (  osg::ref_ptr< osg::Group >  sgroot  ) 
 

constructor takes the root as argument it adds 2 elements to this root. one is for the dots&lines (linedotRoot) the other is for the plane geometry which contains points that also includes roads.(roadRoot) initially the dots and lines are displayed.

Parameters:
sgroot is the root that the RoadMap will be inserted as a child

Definition at line 252 of file Road.cpp.

References currentRoadIndex, dotRootNode, lastRoadIndex, linedotRoot, lineRootNode, pinFlag, and roadRoot.


Member Function Documentation

void RoadMap::addNewRoad (  RoadType  type  ) 
 

add a new Road with the type specified, to the roadMap vector of the theRoadMap object this function also adds the new Road's dotRoot an dlineRoot to dotRootNode and lineRootNode respectively

Parameters:
type the type of the road to be added

Definition at line 277 of file Road.cpp.

References dotRootNode, lastRoadIndex, lineRootNode, Road, and roadMap.

Referenced by RoadForm::OnBnClickedButton10(), RoadForm::OnBnClickedButton5(), RoadForm::OnBnClickedButton6(), and RoadForm::OnBnClickedButton7().

void RoadMap::addPoint (  osg::Vec3  position  ) 
 

adds the specified point to the current Road Object

Parameters:
position is the point to be added

Definition at line 286 of file Road.cpp.

References currentRoadIndex, and roadMap.

Referenced by OSGEventHandler::roadPick().

void RoadMap::addRoadMaptoRoot (  osg::ref_ptr< osg::Group >  sgroot,
int  flag
) 
 

adds the RoadMap to the root given as first argument. if the second argument is a 1 then the dots and line's geode is also added to the tree.

Parameters:
sgroot is the root that the RoadMap will be inserted as a child
flag determines whether the lines and dots will be added to the new root or not

Definition at line 270 of file Road.cpp.

References linedotRoot, and roadRoot.

void RoadMap::addRoadNode (  osg::ref_ptr< osg::Node >  roadNodeToBeAdded  ) 
 

needed for file operations the argument is made the new RoadMap

Parameters:
roadNodeToBeAdded is the new RoadMap node

Definition at line 306 of file Road.cpp.

References roadRoot.

Referenced by FileHandler::loadRoadMap().

void RoadMap::clearRoadMap (   ) 
 

clears all the roads from the map

Definition at line 315 of file Road.cpp.

References currentRoadIndex, dotRootNode, lastRoadIndex, lineRootNode, makedelaunay(), roadMap, and roadRoot.

Referenced by RoadForm::OnBnClickedButton10().

int RoadMap::getActiveRoadIndex (  void   ) 
 

get active Road index

Returns:
the active Road index

Definition at line 296 of file Road.cpp.

References currentRoadIndex.

int RoadMap::getLastRoadIndex (   ) 
 

Returns:
the lastly added Road index

Definition at line 301 of file Road.cpp.

References lastRoadIndex.

Referenced by OSGEventHandler::roadPick().

osg::Vec3d RoadMap::getpt (  const int  np  ) 
 

fills the points array initally for a constructing the ground

Definition at line 204 of file Road.cpp.

Referenced by makedelaunay().

void RoadMap::loadRoadScene (  void   ) 
 

this function should be called whenever the texturized environment is needed. it changes the children of the roadRoot with the new scene.

Definition at line 234 of file Road.cpp.

References makedelaunay(), and roadRoot.

Referenced by RoadForm::OnBnClickedButton9(), and RightView::SetSceneData().

osg::Group * RoadMap::makedelaunay (   ) 
 

this function forms the actual texturized environment added to the scene. the lines of splines are turned into texturized road pieces and placed in the plane.

Returns:
the constructed plane with roads added as a Group

Definition at line 341 of file Road.cpp.

References getpt(), and points.

Referenced by clearRoadMap(), and loadRoadScene().

void RoadMap::pinControl (  osg::ref_ptr< osg::Group >  sgroot  ) 
 

this function removes the dots and lines in the environment from the tree according to the pinFlag's condition. if the flag is 0 meaning the dots and lines are not shown then it becomes one and the linedotRoot is added to the the tree else if the flag is 1, it is made 0 by this function and the linedotRoot is removed from the tree

Parameters:
sgroot is the root that the linedotRoot will be inserted as a child

Definition at line 219 of file Road.cpp.

References linedotRoot, and pinFlag.

Referenced by RoadForm::OnBnClickedButton10().

osg::ref_ptr<osg::Group> RoadMap::returnRoadNode (   )  [inline]
 

returns the RoadMap as a Group

Definition at line 230 of file Road.h.

References roadRoot.

Referenced by FileHandler::saveRoadMap().

void RoadMap::setActiveRoadIndex (  int  index  ) 
 

Set active road index

Parameters:
index is the new active road index

Definition at line 291 of file Road.cpp.

References currentRoadIndex.

Referenced by OSGEventHandler::roadPick().


Friends And Related Function Documentation

friend class Road [friend]
 

Definition at line 143 of file Road.h.

Referenced by addNewRoad().


Member Data Documentation

int RoadMap::currentRoadIndex [private]
 

the active Road index

Definition at line 250 of file Road.h.

Referenced by addPoint(), clearRoadMap(), getActiveRoadIndex(), RoadMap(), and setActiveRoadIndex().

osg::ref_ptr<osg::Group> RoadMap::dotRootNode [private]
 

all Road's dotRoot groups are added to this group

Definition at line 276 of file Road.h.

Referenced by addNewRoad(), clearRoadMap(), and RoadMap().

int RoadMap::lastRoadIndex [private]
 

the lastly added Road index

Definition at line 255 of file Road.h.

Referenced by addNewRoad(), clearRoadMap(), getLastRoadIndex(), and RoadMap().

osg::ref_ptr<osg::Group> RoadMap::linedotRoot [private]
 

dotRootNode and lineRootNode is added to this group and this group is added to the root provided in the initialization in the constructor of RoadMap

Definition at line 287 of file Road.h.

Referenced by addRoadMaptoRoot(), pinControl(), and RoadMap().

osg::ref_ptr<osg::Group> RoadMap::lineRootNode [private]
 

all Road's lineRoot groups are added to this group

Definition at line 281 of file Road.h.

Referenced by addNewRoad(), clearRoadMap(), and RoadMap().

int RoadMap::pinFlag [private]
 

the flag for control of the pins and lines

Definition at line 260 of file Road.h.

Referenced by pinControl(), and RoadMap().

osg::Vec3Array* RoadMap::points [private]
 

the plane's points

Definition at line 265 of file Road.h.

Referenced by makedelaunay().

vector<Road *> RoadMap::roadMap [private]
 

the added Road objects kept int this vector

Definition at line 245 of file Road.h.

Referenced by addNewRoad(), addPoint(), and clearRoadMap().

osg::ref_ptr<osg::Group> RoadMap::roadRoot [private]
 

makedelaunay function adds the node containing the goede that involves points with texturing

Definition at line 271 of file Road.h.

Referenced by addRoadMaptoRoot(), addRoadNode(), clearRoadMap(), loadRoadScene(), returnRoadNode(), and RoadMap().

osg::ref_ptr<osg::Group> RoadMap::savedMap [private]
 

holding the previously saved osg models. in each save operation the road structure is added to this root as a child.

Definition at line 293 of file Road.h.


The documentation for this class was generated from the following files:
Generated on Sun May 28 18:54:14 2006 for TraffEdu by  doxygen 1.4.6-NO